<?php

require_once BaseUtil::getModulePath("base") . '/forms/BaseForm.php';
require_once BaseUtil::getModulePath("base") . '/validate/Unique.php';

class FeaturepageForm extends BaseForm {
	
	public function __construct($edit = false,$oagesid = null) {
		parent::__construct();
		if($edit) {
			$this->setAction(HttpUtil::getUrl("featurepage","subedit"));
		}else {
			$this->setAction(HttpUtil::getUrl("featurepage","subadd"));
		}
		//id
		if($edit){
			$id=new Zend_Form_Element_Hidden('id');
			$this->addElement($id);
		}
		//url
		$url=new Zend_Form_Element_Text('url');
		$url->setLabel($this->translate->_('url'));
		$url->addFilter('StringTrim');
		$url->setRequired(true);
		//css
		$css=new Zend_Form_Element_Textarea('css');
		$css->setLabel($this->translate->_('css'));
		$css->setAttribs(array("rows" => 5,"cols" => 40));
		$css->addFilter('StringTrim');		
		
		//javascript
		$javascript=new Zend_Form_Element_Textarea('javascript');
		$javascript->setLabel($this->translate->_('javascript'));
		$javascript->setAttribs(array("rows" => 5,"cols" => 40));
		$javascript->addFilter('StringTrim');		
		//html
		$html=new Zend_Form_Element_Textarea('html');
		$html->setLabel($this->translate->_('html'));
		$html->setAttribs(array("rows" => 10,"cols" =>60));
		$html->addFilter('StringTrim');		
		
		$this->addElements(array($url,$css,$javascript,$html));
		
		$this->setElementDecorators(array ('ViewHelper',array(array('div' =>'HtmlTag'),array('tag' =>'div',"class" => "form_element" ) ) ) );
		
	}
	
}